//
//  ViewController.m
//  BM4GroupDemo
//
//  Created by apple on 16/2/17.
//  Copyright © 2016年 ZR. All rights reserved.
//

#import "ViewController.h"
#import "DashLineViewController.h"
#import "LoginController.h"
#import <BMSpinnerView.h>

@interface ViewController ()

@property (nonatomic,strong) BMSpinnerView *spinnerView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIButton *dashlineButton = [UIButton buttonWithType:UIButtonTypeSystem];
    dashlineButton.frame = CGRectMake(10, 60,100, 40);
    dashlineButton.backgroundColor = [UIColor yellowColor];
    [dashlineButton setTitle:@"画虚线" forState:UIControlStateNormal];
    [dashlineButton addTarget:self action:@selector(drawDashLine) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:dashlineButton];
    
    
    UIButton *loginButton = [UIButton buttonWithType:UIButtonTypeSystem];
    loginButton.frame = CGRectMake(10, dashlineButton.frame.size.height + dashlineButton.frame.origin.y + 10, dashlineButton.frame.size.width, dashlineButton.frame.size.height);
    loginButton.backgroundColor = [UIColor yellowColor];
    [loginButton setTitle:@"登录界面" forState:UIControlStateNormal];
    [loginButton addTarget:self action:@selector(login) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:loginButton];
    
    self.spinnerView = [[BMSpinnerView alloc] init];
    NSString *str = @"周一，周二，周三，周四，周五，周六，周日";
    self.spinnerView.datas = [str componentsSeparatedByString:@"，"];
    UIButton *spinnerBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    spinnerBtn.backgroundColor = [UIColor yellowColor];
    spinnerBtn.frame = CGRectMake(10, loginButton.frame.origin.y + loginButton.frame.size.height + 10, dashlineButton.frame.size.width, dashlineButton.frame.size.height);
    [spinnerBtn setTitle:@"下拉" forState:UIControlStateNormal];
    [spinnerBtn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:spinnerBtn];
}

- (void)click:(UIButton *)button{
    
    [_spinnerView showBelowWith:button];
}

- (void)drawDashLine{
    [self presentViewController:[DashLineViewController new] animated:YES completion:nil];
}
- (void)login{
    [self presentViewController:[LoginController new] animated:YES completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
